package com.xd.user.api.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.xd.common.base.BaseModel;
import com.xd.common.vo.Validity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.*;
import java.math.BigDecimal;

/**
 * @author Exrick
 */
@Data
@Entity
@Accessors(chain = true)
@Table(name = "xd_dict")
@org.hibernate.annotations.Table(appliesTo = "xd_dict", comment = "字典")
@TableName("xd_dict")
@ApiModel(value = "字典")
public class Dict extends BaseModel<Department> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "字典名称")
    @Column(nullable = false, columnDefinition = "varchar(100)  default '' comment '字典名称'")
    @NotBlank(message = "字典名称不可为空", groups = {Validity.Add.class, Validity.Upload.class})
    @Size(message = "字典名称字数不可大于100", groups = {Validity.Add.class, Validity.Upload.class})
    private String title;

    @ApiModelProperty(value = "字典类型")
    @Column(nullable = false, columnDefinition = "varchar(100)  default '' comment '字典类型'")
    @NotBlank(message = "字典类型不可为空", groups = {Validity.Add.class, Validity.Upload.class})
    @Size(message = "字典类型字数不可大于100")
    private String type;


    @ApiModelProperty(value = "排序值")
    @Column(precision = 10, scale = 2, columnDefinition = "decimal default 0 comment '排序值 '")
    @NotNull(message = "排序值不可为空", groups = {Validity.Add.class, Validity.Upload.class})
    @Digits(message = "排序值精度错误", fraction = 2, integer = 3, groups = {Validity.Add.class, Validity.Upload.class})
    private Double sortOrder;
}
